package client.view;

import client.exceptions.NotInitializedException;

/**
 * 
 * @author Niclas
 */
public class RepaintNotifier {
	
	MainForm mf;
	
	private static RepaintNotifier instance = null;
	 
    public RepaintNotifier(MainForm mf) {
		this.mf = mf;
	}

	public static RepaintNotifier makeInstance(MainForm mf) {
        if (instance == null) {
            instance = new RepaintNotifier(mf);
        }
        return instance;
    }
	public static RepaintNotifier getInstance() {
		if (instance == null){
			try {
				throw new NotInitializedException("RepaintNotifier must be Initialized with \"makeInstance(MainForm)\".");
			} catch (NotInitializedException e) {
				e.printStackTrace();
			}
		}
        return instance;
    }
    
    public void doRepaint(){
    	mf.repaint();
    }
}
